How can I optimize a SQL query to improve its performance for specific conditions

welcome to shbcf.ru